﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.LongER.Framework.Utils;
using Com.LongER.Business.ZCH002;
using Com.LongER.Business.ZCH002.ZCH002DSTableAdapters;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using Com.LongER.Framework.Utils.LogUtils;


namespace Com.LongER.Business.ZCH002
{
    public class CZCH002 : ABussinessBase
    {
        private Log log = Log.GetInstance();

        /// <summary>
        /// 获取调度指示_H信息的值
        /// </summary>
        /// <returns></returns>
        public ZCH002DS.T_DIAODU_HDataTable GetDIAODU_H(String strDLNO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_HTableAdapter ta = new T_DIAODU_HTableAdapter(connectionString);

            ZCH002DS.T_DIAODU_HDataTable tb = ta.GetData(strDLNO);
            ta.Connection.Close();
            return tb;
        }

        /// <summary>
        /// 获取调度指示_M信息的值
        /// </summary>
        /// <returns></returns>
        public ZCH002DS.T_DIAODU_MDataTable GetDIAODU_M(String strDLNO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_MTableAdapter ta = new T_DIAODU_MTableAdapter(connectionString);

            ZCH002DS.T_DIAODU_MDataTable tb = ta.GetData(strDLNO);
            ta.Connection.Close();
            return tb;
        }

        /// <summary>
        /// 获取订单信息的值
        /// </summary>
        /// <returns></returns>
        public ZCH002DS.T_ORDERDataTable GetONO(String strONO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_ORDERTableAdapter ta = new T_ORDERTableAdapter(connectionString);

            ZCH002DS.T_ORDERDataTable tb = ta.GetData(strONO);
            ta.Connection.Close();
            return tb;
        }

        /// <summary>
        /// 追加调度指示_H信息的值
        /// </summary>
        /// <returns></returns>
        public Boolean InsertT_DIAODU_H(String strNewDLNO, String strNewCHEPAI_NUM,
                                        String strNewCHELIANG_XINGTAI, String strNewSUOSHU_KBN,
                                        String strNewHETONG_BIANHAO,Decimal  strNewHETONG_YUNFEI,
                                        String strNewCHEZHU, String strNewCHEZHU_NAME, String strNewTEL_NUM1, String strNewTEL_NUM2,
                                        String strNewSHIJI_STA,
                                        String strNewFAHUO_YUDING_DAY,String  strNewFAHUO_YUDING_TIME,
                                        Decimal strNewDIAODU_COUNTS, Decimal strNewDIAODU_WEIGHT, String strNewDIAODU_MAN,
                                        String strNewBEIZHU)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_HTableAdapter ta = new T_DIAODU_HTableAdapter(connectionString);

            int result = ta.IstDiaoDu_H(strNewDLNO, strNewCHEPAI_NUM,
                                        strNewCHELIANG_XINGTAI, strNewSUOSHU_KBN,
                                        strNewHETONG_BIANHAO, strNewHETONG_YUNFEI,
                                        strNewCHEZHU, strNewCHEZHU_NAME, strNewTEL_NUM1, strNewTEL_NUM2,
                                        strNewSHIJI_STA,
                                        strNewFAHUO_YUDING_DAY, strNewFAHUO_YUDING_TIME,
                                        strNewDIAODU_COUNTS, strNewDIAODU_WEIGHT, strNewDIAODU_MAN,
                                        strNewBEIZHU);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }

        /// <summary>
        /// 追加调度指示_M信息的值
        /// </summary>
        /// <returns></returns>
        public Boolean InsertT_DIAODU_M(String strNewDLNO,String  strNewSUB_NO,String  strNewONO,
                                        String strNewPINMING_CD, Decimal strNewLENGTH, Decimal strNewWIDTH, Decimal strNewHIGHTH,
                                        Decimal strNewWEIGHT, Decimal strNewCOUNTS,
                                        Decimal strNewCHENGYUN_COSTS, String strNewZHIFU_TYPE,
                                        String strNewAGENT, String strNewZHUANGHUO, String strNewXIEHUO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_MTableAdapter ta = new T_DIAODU_MTableAdapter(connectionString);

            int result = ta.IstDiaoDu_M(strNewDLNO, strNewSUB_NO, strNewONO,
                                        strNewPINMING_CD, strNewLENGTH, strNewWIDTH, strNewHIGHTH,
                                        strNewWEIGHT, strNewCOUNTS,
                                        strNewCHENGYUN_COSTS, strNewZHIFU_TYPE,
                                        strNewAGENT, strNewZHUANGHUO, strNewXIEHUO);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }


        /// <summary>
        /// 更新调度指示_H表
        /// </summary>
        /// <param name="strUserId"></param>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public Boolean UpdateT_DIAODU_H(String strNewCHEPAI_NUM,
                                        String strNewCHELIANG_XINGTAI, String strNewSUOSHU_KBN,
                                        String strNewHETONG_BIANHAO, Decimal strNewHETONG_YUNFEI,
                                        String strNewCHEZHU, String strNewCHEZHU_NAME, String strNewTEL_NUM1, String strNewTEL_NUM2,
                                        String strNewSHIJI_STA,
                                        String strNewFAHUO_YUDING_DAY, String strNewFAHUO_YUDING_TIME,
                                        Decimal strNewDIAODU_COUNTS, Decimal strNewDIAODU_WEIGHT, String strNewDIAODU_MAN,
                                        String strNewBEIZHU,
                                        String strNewDLNO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_HTableAdapter ta = new T_DIAODU_HTableAdapter(connectionString);

            int result = ta.UpdDiaoDu_H(strNewCHEPAI_NUM,
                                        strNewCHELIANG_XINGTAI,  strNewSUOSHU_KBN,
                                        strNewHETONG_BIANHAO,  strNewHETONG_YUNFEI,
                                        strNewCHEZHU,  strNewCHEZHU_NAME,  strNewTEL_NUM1,  strNewTEL_NUM2,
                                        strNewSHIJI_STA,
                                        strNewFAHUO_YUDING_DAY,  strNewFAHUO_YUDING_TIME,
                                        strNewDIAODU_COUNTS,  strNewDIAODU_WEIGHT,  strNewDIAODU_MAN,
                                        strNewBEIZHU,
                                        strNewDLNO);
            if (result <= 0) return false;

            ta.Connection.Close();

            if (result > 0) return true;

            return false;
        }

        /// <summary>
        /// 删除调度指示_H信息
        /// </summary>
        /// <returns></returns>
        public Boolean DeleteDiaoDu_H(String strDLNO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_HTableAdapter ta = new T_DIAODU_HTableAdapter(connectionString);

            int result = ta.DltDiaoDu_H(strDLNO);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }

        /// <summary>
        /// 删除调度指示_M信息
        /// </summary>
        /// <returns></returns>
        public Boolean DeleteDiaoDu_M(String strDLNO)
        {
            String connectionString = ConnectionStringUtil.GetConnectionString();
            T_DIAODU_MTableAdapter ta = new T_DIAODU_MTableAdapter(connectionString);

            int result = ta.DltDiaoDu_M(strDLNO);
            ta.Connection.Close();
            if (result > 0) return true;

            return false;
        }

    }
}
